$(function(){
    // 基于准备好的dom，初始化echarts图表
var myChart1 = echarts.init(document.getElementById('main1')); 
var myChart2 = echarts.init(document.getElementById('main2')); 
var myChart3 = echarts.init(document.getElementById('main3')); 
// app.title = '嵌套环形图';
var optionbox = {
    option1: {
        color:['red', '#7e8c8e','#2dcc70'],
        tooltip: {
            trigger: 'item',
        },
        legend: {
            orient: 'vertical',
            x: 'left',
            data:[]
        },
        series: [
            
            {
                name:'',
                type:'pie',
                radius: ['40%', '75%'],
                label: {
                    normal: {
                        rich: {
                            a: {
                                color: '#999',
                                lineHeight:54,
                                align: 'left',
                            }
                        }
                    }
                },
                data:[
                    {value:'11',name:"0"},
                    {value:154,name:"54"},
                    {value:'925',name:'1925'}
                ]
            }
        ]
    },
    option2: {
        color:['red', '#7e8c8e','#2dcc70'],
        tooltip: {
            trigger: 'item',
        },
        legend: {
            orient: 'vertical',
            x: 'left',
            data:[]
        },
        series: [
            
            {
                name:'',
                type:'pie',
                radius: ['40%', '75%'],
                label: {
                    normal: {
                        rich: {
                            a: {
                                color: '#999',
                                lineHeight:54,
                                align: 'left',
                            }
                        }
                    }
                },
                data:[
                    {value:'1',name:"0"},
                    {value:54,name:"54"},
                    {value:'925',name:'1925'}
                ]
            }
        ]
    },
    option3: {
        color:['red', '#7e8c8e','#2dcc70'],
        tooltip: {
            trigger: 'item',
        },
        legend: {
            orient: 'vertical',
            x: 'left',
            data:[]
        },
        series: [
            
            {
                name:'',
                type:'pie',
                radius: ['40%', '75%'],
                label: {
                    normal: {
                        rich: {
                            a: {
                                color: '#999',
                                lineHeight:54,
                                align: 'left',
                            }
                        }
                    }
                },
                data:[
                    {value:'2',name:"0"},
                    {value:74,name:"74"},
                    {value:'825',name:'1905'}
                ]
            }
        ]
    }
    
};


// 为echarts对象加载数据 
myChart1.setOption(optionbox.option1);
myChart2.setOption(optionbox.option2);
myChart3.setOption(optionbox.option3);

var myChart4 = echarts.init(document.getElementById('centershuju')); 
var option4 = {
    color:['rgb(164,205,238)','rgb(42,170,227)','rgb(25,46,94)','rgb(195,229,235)'],
    xAxis: {
        type: 'category',
        data: ['朝阳所1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22'],
        //设置字体倾斜
        axisLabel:{
            interval:0,
            rotate:45,//倾斜度 -90 至 90 默认为0
            margin:8,
            textStyle:{
                fontWeight:"400",
                color:"#222222"
            }
        }
    },
    yAxis: {
        type: 'value'
    },
    // series: [
    //     {
    //     data: [100, 80, 90, 40, 20, 95,100,100,100,70,100,99,99,100,98,100,100,92,100,94,100,100],
    //     type: 'bar'
    //     },
    // ],
    series: [{
        "name": "销量",
        "type": "bar",
        "data": [100, 80, 90, 40, 20, 95,100,100,100,70,100,99,99,100,98,100,100,92,100,94,68,100],
        itemStyle: {
            normal: {
                label: {
                    show: true, //开启显示
                    position: 'inside', //在上方显示
                    textStyle: { //数值样式
                        color: '#fff',
                        fontSize: 12,
                    }
                },
                color: function(params) {
                    // build a color map as your need.
                    var colorList = [
                      '#C1232B','#B5C334','#FCCE10','#E87C25','#27727B',
                       '#FE8463','#9BCA63','#FAD860','#F3A43B','#60C0DD',
                       '#D7504B','#C6E579','#F4E001','#F0805A','#26C0C0',
                       '#D7504B','#C6E579','#F4E001','#F0805A','#26C0C0',
                       '#D7504B','#C6E579'
                    ];
                    return colorList[params.dataIndex]
                },
            }
        },
    }]
};
myChart4.setOption(option4);




});
